import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * This class makes reference to the Laser of the motherShip when she will shoot the killer laser.
 * 
 * @author (Arturo Aaron Rios Obregon) 
 * @version (25 june 2013)
 */
public class LaserMadre extends Bala
{
    private GreenfootImage [] images;
    private int numImage;
    private SimpleTimer cTimer;
    
    /**
     * Constructor
     */
    public LaserMadre()
    {
        super(20);
        images = new GreenfootImage[4];
        images[0] = new GreenfootImage("LaserMAdre.png");
        images[1] = new GreenfootImage("LaserMAdreAma.png");
        images[2] = new GreenfootImage("LaserMAdreAzul.png");
        images[3] = new GreenfootImage("LaserMAdreVerde.png");
        numImage=0;
        setImage(images[0]);    
        cTimer = new SimpleTimer();
        cTimer.mark();
    }
    
    /**
     * change images and eliminate.
     */
    public void act() 
    {
        imagenes();
        elimina();
    }    
    
    /**
     * Eliminate the laser after certain time.
     */
    public void elimina()
    {
        if(cTimer.millisElapsed()/1000>5)
            getWorld().removeObject(this);
    }
    
    /**
     *  change the images for the laser.
     */
    public void imagenes()
    {                
        numImage+=1;
        numImage=numImage%4;
        setImage(images[numImage]);
    }
}
